<?php $ranking_obj = new CategoryWebsiteRanking();?>
<?php foreach ($this->histories as $history): ?>
	<?php 
		$rankings = $ranking_obj->find_all(array('history_id' => $history->id ));
	?>
	<?php if(count($rankings) > 0):?>
	<h4><?php echo $history->name; ?></h4>
	<table class="table-3" width="500px">
		<thead>
			<th>Rank</th> <th>Name</th> <th>Count</th> <th>Pos rank</th> <th>Pos count</th>
		</thead>
		<tbody>
		<?php 
		
			foreach ($rankings as $ranking):
		?>	
				<tr>
					<td>
						<?php echo $ranking->rank;?>
					</td>
					<td>
						<a class="website_ranking_menu" href="#<?php echo $ranking->category_id ?>" ><?php echo $ranking->category_name;?></a>
					</td>
					<td>
						<?php echo $ranking->count;?>
					</td>
					<td>
						<?php echo $ranking->position_rank;?>
					</td>
					<td>
						<?php echo $ranking->position_count;?>
					</td>
				</tr>
		<?php 		
			endforeach;
		?>
		</tbody>
	</table>
	<br/>
	<?php endif; ?>
<?php endforeach; ?>

<script>

	//var menu = {'page':'Page Ranking', 'keyword':'Keyword Ranking'};
	//$(".website_ranking_menu").dContextMenu(menu, {'params':{'id':1,'b':2},'handle':'website_ranking_menu_handle'});

	
</script>
